import 'package:fish_redux/fish_redux.dart';

import 'action.dart';
import 'state.dart';

Reducer<SearchViewState> buildReducer() {
  return asReducer(
    <Object, Reducer<SearchViewState>>{
      SearchViewAction.action: _onAction,
      SearchViewAction.onGetHistoryList: _onGetHistoryList,
    },
  );
}

SearchViewState _onAction(SearchViewState state, Action action) {
  final SearchViewState newState = state.clone();
  return newState;
}


SearchViewState _onGetHistoryList(SearchViewState state, Action action) {
  final SearchViewState newState = state.clone();
  newState.historyList = action.payload;
  return newState;
}